import request from "@/utils/request";
import type { AccountLogin, UserInfo, WxLogin } from "@/types/user";
import type { ResponseType } from "@/types/response";

enum Enum {
    simple = "/login/wxMin/simple",
    password = "/login",
    wxLogin = "/login/wxMin"
}

/*快捷登录的接口*/
export const simpleLoginAPI = (phoneNumber: string): Promise<ResponseType<UserInfo>> => request.post<UserInfo, ResponseType<UserInfo>>(Enum.simple, { phoneNumber });

/*用户名+密码登录的接口*/
export const passwordLoginAPI = (data: AccountLogin): Promise<ResponseType<UserInfo>> => request.post<UserInfo, ResponseType<UserInfo>>(Enum.password, data);

/*微信登录的接口*/
export const wxLoginAPI = (data: WxLogin): Promise<ResponseType<UserInfo>> => request.post<UserInfo, ResponseType<UserInfo>>(Enum.wxLogin, data);
